<?php
class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
    	
  		//Create Form
	    $form = new Zend_Form();
	    $form->setAction('index');
	    $form->setMethod('post'); // POST GET
	    $form->setAttrib('sitename', 'Test Library');
	    //Load Elements class
	    require "/../forms/BugReportForm.php";
	    $LoudbiteElements = new Form_BugReportForm();
	    //Create Username Field.
	    $form->addElement($LoudbiteElements->getUsernameTextField());
	        
	    //Create Password Field.
	    $form->addElement($LoudbiteElements->getPasswordTextField());
	        
	    //Create Email Field.
	    $form->addElement($LoudbiteElements->getEmailTextField());
	    
	    //Create Submit Element
	    $form->addElement($LoudbiteElements->getSubmitElement());
	    if($_POST){
	        //Check if the form is valid.
	
	        if($form->isValid($_POST)){
	            //Get the values
	            $username = $form->getValue('username');
	            $password = $form->getValue('password');
	            $email    = $form->getValue('email');
	                        //Save.
	            $this->_forward('success');
	        }
	        //Otherwise redisplay the form.
	        else{
	            $this->view->form   = $form;
	        }
	    }
	    //Otherwise display the form.
	    else{
	        $this->view->form = $form;
	    }
	    
    	
    }
  
	public function successAction()
	{
		echo "Congratulation!!";
	}

}







